//把文件中的数据读取出来，并输出
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>

typedef struct Studentdate
{
    int IID;
    char NName[20];
    float SScore;
}STU;

int main(int argc,char *argv[])
{
    FILE *file=fopen(argv[1],"r");
    if(NULL==file)
    {
        printf("errno=%d,error=%s\n",errno,strerror(errno));
        exit(EXIT_FAILURE);
    }
    printf("open %s ok\n",argv[1]);
    
    STU stu;
    int ret=0;
    while (1)
    {
        ret=fscanf(file,"%d%s%f",&stu.IID,stu.NName,&stu.SScore);
        if(ret>0)
        {
            printf("ID=%d,name=%s,score=%g\n",stu.IID,stu.NName,stu.SScore);
        }
        else
        {
            return 0;
        }
        
    }
    
    return 0;
}
